package org.rvk.vms.dal.entities;

import java.io.Serializable;

import javax.persistence.*;

import org.rvk.vms.dal.model.EventStatus;
import org.rvk.vms.dal.model.EventType;

import java.sql.Timestamp;
import java.util.Date;


/**
 * The persistent class for the event database table.
 * 
 * @author Ashish Kumar Sinha <aksinha.mail@gmail.com>
 */
@Entity
@NamedQuery(name="Event.findAll", query="SELECT e FROM Event e ORDER BY e.code DESC")
public class Event implements Serializable {

	private static final long serialVersionUID = 3972656151266645633L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(unique=true, nullable=false)
	private int id;

	private String city;

	private String code;

	private String country;

	@Temporal(TemporalType.TIMESTAMP)
	private Date createdAt;

	private String description;

	private int dayscount;

	private String name;
	
	private String type;
	private String status;

	private String pincode;

	@Column(name="public")
	private byte ispublic;

	@Temporal(TemporalType.DATE)
	private Date startdatetime;

	private String state;

	private Timestamp updatedAt;

	private String venue;

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the code
	 */
	public String getCode() {
		return code;
	}

	/**
	 * @param code the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * @param country the country to set
	 */
	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * @return the createdAt
	 */
	public Date getCreatedAt() {
		return createdAt;
	}

	/**
	 * @param createdAt the createdAt to set
	 */
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the dayscount
	 */
	public int getDayscount() {
		return dayscount;
	}

	/**
	 * @param dayscount the dayscount to set
	 */
	public void setDayscount(int dayscount) {
		this.dayscount = dayscount;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the pincode
	 */
	public String getPincode() {
		return pincode;
	}

	/**
	 * @param pincode the pincode to set
	 */
	public void setPincode(String pincode) {
		this.pincode = pincode;
	}

	/**
	 * @return the ispublic
	 */
	public byte getIspublic() {
		return ispublic;
	}

	/**
	 * @param ispublic the ispublic to set
	 */
	public void setIspublic(byte ispublic) {
		this.ispublic = ispublic;
	}

	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @return the updatedAt
	 */
	public Timestamp getUpdatedAt() {
		return updatedAt;
	}

	/**
	 * @param updatedAt the updatedAt to set
	 */
	public void setUpdatedAt(Timestamp updatedAt) {
		this.updatedAt = updatedAt;
	}

	/**
	 * @return the venue
	 */
	public String getVenue() {
		return venue;
	}

	/**
	 * @param venue the venue to set
	 */
	public void setVenue(String venue) {
		this.venue = venue;
	}

	/**
	 * @return the type
	 */
	public EventType getEventType() {
		return EventType.get(type);
	}

	/**
	 * @param type the type to set
	 */
	protected void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the startdatetime
	 */
	public Date getStartdatetime() {
		return startdatetime;
	}

	/**
	 * @param startdatetime the startdatetime to set
	 */
	public void setStartdatetime(Date startdatetime) {
		this.startdatetime = startdatetime;
	}

	/**
	 * @param status the status to set
	 */
	protected void setStatus(String status) {
		this.status = status;
	}
	
	public EventStatus getEventStatus(){
		return EventStatus.get(status);
	}


}